package com.s_widget;

import android.os.Bundle;
import android.view.View;

import androidx.appcompat.app.AppCompatActivity;

import com.s_widget.bean.PickerBean;

import java.util.ArrayList;
import java.util.List;

public class PickerActivity extends AppCompatActivity implements View.OnClickListener {

    private StringWheelPicker mPicker;

    private List<PickerBean> datas;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_picker);
        mPicker = findViewById(R.id.picker);
        findViewById(R.id.btn).setOnClickListener(this);
        datas = new ArrayList<>();
    }


    @Override
    public void onClick(View v) {
        datas.clear();
        for (int i = 0; i<10; i++){
            datas.add(new PickerBean("第" + i + "条数据", i));
        }
        mPicker.setData(datas, 3);
    }
}
